Preconditions
Simple static methods to be called at the start of your own methods to verify correct arguments and state.
Functions
Link copied to clipboard
open fun checkArgument(expression: Boolean, @NonNull messageTemplate: @NonNull String, messageArgs: @NonNull Array<Any>)
Ensures that an expression checking an argument is true.
Link copied to clipboard
Ensures that the argument floating point value is a finite number.
Link copied to clipboard
open fun checkArgumentInRange(value: Double, lower: Double, upper: Double, @NonNull valueName: @NonNull String): Double
Ensures that the argument double value is within the inclusive range.
open fun checkArgumentInRange(value: Float, lower: Float, upper: Float, @NonNull valueName: @NonNull String): Float
Ensures that the argument float value is within the inclusive range.
open fun checkArgumentInRange(value: Int, lower: Int, upper: Int, @NonNull valueName: @NonNull String): Int
Ensures that the argument int value is within the inclusive range.
open fun checkArgumentInRange(value: Long, lower: Long, upper: Long, @NonNull valueName: @NonNull String): Long
Ensures that the argument long value is within the inclusive range.
Link copied to clipboard
Ensures that that the argument numeric value is non-negative.
Link copied to clipboard
Check the requested flags, throwing if any requested flags are outside the allowed set.
Link copied to clipboard
open fun <T> checkNotNull(@Nullable reference: @Nullable T, @NonNull errorMessage: @NonNull Any): @NonNull T
Ensures that an object reference passed as a parameter to the calling method is not null.
Link copied to clipboard
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.
Link copied to clipboard
open fun <T : CharSequence?> checkStringNotEmpty(@Nullable string: @Nullable T, @NonNull errorMessage: @NonNull Any): @NonNull T
open fun <T : CharSequence?> checkStringNotEmpty(@Nullable string: @Nullable T, @NonNull messageTemplate: @NonNull String, messageArgs: @NonNull Array<Any>): @NonNull T
Ensures that an string reference passed as a parameter to the calling method is not empty.